/**
 * Created by hxpeng on 2017/3/24.
 */

(function () {
    'use strict';

    angular.module('App.pages.member')
        .service('MemberModel', MemberModel);

    function MemberModel(API,$resource) {
        this.actions = {}


        /**
         * 绑定微信号并创建一个家长成员
         * @type {{method: string, url: string}}
         */
        this.actions.createParent = {
            method: 'post',
            url: API + '/wechat/member/createParent'
        }
        /**
         * 家长绑定/添加 宝宝
         * @type {{method: string, url: string}}
         */
        this.actions.studentBindParent = {
            method: 'post',
            url: API + '/wechat/member/studentBindParent'
        }

        /**
         *  根据成员ID，查询一个成员
         * @type {{method: string, url: string}}
         */
        this.actions.getMemberInfo = {
            method: 'post',
            url: API + '/member/getMemberInfo'
        }


        this.actions.findOneStudent = {
            method: 'post',
            url: API + '/member/findOneStudent'
        }

        /**
         * 和微信号绑定
         * @type {{method: string, url: string}}
         */
        this.actions.bindWeChatInfo = {
            method: 'POST',
            url: API + '/member/bindWeChatInfo'
        }
        /**
         * 获取父母成员信息
         * @type {{method: string, url: string}}
         */
        this.actions.getParentInfo = {
            method: 'POST',
            url: API + '/member/getParentInfo'
        }
        /**
         * 保存成员信息
         * @type {{method: string, url: string}}
         */
        this.actions.saveParentMemberInfo = {
            method: 'POST',
            url: API + '/member/saveParentMemberInfo'
        }

        /**
         *提交微信返回上传图片的serverId数组
         * @type {{method: string, url: string}}
         */
        this.actions.submitUploadImg = {
            method: 'POST',
            url: API + '/member/submitUploadImg'
        }

        /**
         * 精彩瞬间
         * @type {{method: string, url: string}}
         */
        this.actions.queryStudentsPhoto = {
            method: 'POST',
            url: API + '/member/queryStudentsPhoto'
        }

        /**
         * 查找学生列表
         * @type {{method: string, url: string}}
         */
        this.actions.getStudentList = {
            method: 'POST',
            url: API + '/class/getStudentList'
        }

        /**
         * 返回父母成员ID
         * @type {{method: string, url: string}}
         */
        this.actions.getParentId = {
            method: 'POST',
            url: API + '/member/getParentId'
        }

        this.actions.studentHadBind = {
            method: 'POST',
            url: API + '/member/studentHadBind'
        }

        this.actions.getfamilyInfo = {
            method: 'POST',
            url: API + '/member/getFamilyInfo'
        }

        /**
         * 返回学生信息与家长关系
         * @type {{method: string, url: string}}
         */
        this.actions.getStudentInfoByParentId={
            method: 'POST',
            url:API+'/member/getStudentInfoByParentId'
        }

        /**
         * 更改家属关系
         * @type {{method: string, url: string}}
         */
        this.actions.changeRel={
            method:'POST',
            url:API+'/member/changeRel'
        }

        /**
         * 更改个人信息
         * @type {{method: string, url: string}}
         */
        this.actions.Modify={
            method:'POST',
            url:API+'/member/Modify'
        }

        this.actions.getMemberList= {
            method: 'POST',
            url: API + '/member/getMemberList'
        }

        /**
         * 根据当前登录人返回当前班级成员信息
         */
        this.actions.getMemberList = {
            method: 'POST',
            url: API + '/wechat/member/getMemberList'
        }

        /**
         * 根据输入名称查找学生
         */
        this.actions.getStudentName = {
            method: 'POST',
            url: API + '/wechat/member/getStudentName'
        }

        /**
         * 根据学生ID查找周评信息
         */
        this.actions.getAssessById = {
            method: 'POST',
            url: API + '/wechat/member/getAssessById'
        }

        /**
         * 进入周评主页的查询，可以滑动
         */
        this.actions.findAssess = {
            method: 'POST',
            url: API + '/wechat/member/findAssess'
        }

        /**
         * 保存周评信息
         */
        this.actions.saveAssess = {
            method: 'POST',
            url: API + '/wechat/member/saveAssess'
        }

        /**
         * 查询学生5天内的周评走势
         */
        this.actions.findAssessReport = {
            method: 'POST',
            url: API + '/wechat/member/findAssessReport'
        }

        /**
         * 滑动日期查看一周的走势
         */
        this.actions.findReportSlide = {
            method: 'POST',
            url: API + '/wechat/member/findReportSlide'
        }

        /**
         * 统计月为周期的走势
         */
        this.actions.findReportMonthYear = {
            method: 'POST',
            url: API + '/wechat/member/findReportMonthYear'
        }

        this.actions.saveAssessTwo = {
            method: 'POST',
            url: API + '/wechat/member/saveAssessTwo'
        }

        this.actions.findMemberId = {
            method: 'POST',
            url: API + '/wechat/member/findMemberId'
        }

        return $resource.call(this, this.url, this.params, this.actions)
    }

})();